selectFirstFromMultiple = function() {
    var selectMultipleList = $('select[multiple=""]');
    selectMultipleList.each(function() {
        var currentSelect = $(this);
        var optionList = currentSelect.children();
        var firstOption = optionList.first();
        currentSelect.val(firstOption.val());
    });
};

validateForm = function() {
    selectFirstFromMultiple();
    $('form').validate({
        rules: {
            'statusMov[]': 'required'
        }
    });
};

showLoadingGIF = function() {
    if ($('form').valid()) {
        $('div#carregando-gif').show();
    }
};

insertShowLoading = function() {
    $('input.demorado').click(showLoadingGIF);

};

$(document).ready(validateForm);
$(document).ready(insertShowLoading);

